package com.shr.code_interview;

public class Solution_15 {
    public static int NumberOf1(int n) {
        int flag = 1;
        int count = 0;
    	do{
    		if((flag & n) != 0)
    			count ++ ;
    		flag = flag << 1;
    	}while(flag != 0) ;
    	return count ;
    }
    
    public static void main(String[] args) {
//    	System.out.println(-1 << 10);
//    	System.out.println(Integer.toString(-2, 2));
//    	System.out.println(Integer.toString(-2 >> 10,2));
//    	System.out.println(-1 >>> 30);
//		int a = -8;
//		System.out.println((int)Math.pow(2, 31));
    	System.out.println(Integer.MIN_VALUE << 1);
    	System.out.println(NumberOf1(Integer.MIN_VALUE ));
	}
}
